<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>工作动态详情</title>
	</head>
	<body>
		<div data-role="page" id="mobile-dynamicbill-show-page" class="page-div-style">
			<script>
		$('#mobile-dynamicbill-show-page').live('pagebeforeshow',dynamicbillShowInfo);
		function dynamicbillShowInfo(){
			//页面载入判断是否有菜单配置,没有就返回首页
			if(menuMapFail())
			{
				return false;
			}
			//显示头部栏
	 		initHeader($("#mobileDynamicbillShowHeader"),"back");
	 		$("#mobileDynamicbillShowHeader").find("[name='mobileHeaderTitle']").text("新闻详情");
	 		
	 		$("#mobileDynamicbillShowBar").empty();
			//组织显示底部导航栏
        	showFooterBar("mobileDynamicbillShowBar");
			
			//为"2"时不更新页面
			if(window.is_load_dynamicbill_info == "2"){
				return false;
			}
			
			var dynamicbillId = typeof(window.dynamicbillId) == "undefined" ? "" : $.trim(window.dynamicbillId);
		
			if(dynamicbillId == ""){
				loadingFail();
				window.is_load_dynamicbill_info == "1";
				return false;
			}
			
			//加载等待
			showLoadPage();
			
			$.ajax({
                url:window.serverUrl+"/mobile/dynamicbillShow.do?callback=?",
                async: true,
                type:"GET",
                data:{"dynamicbillId":dynamicbillId},
                dataType:"jsonp",
               	success:function(data){
		            if(data.nResult == "1"){
		            	//工作动态信息
		            	var dynamicbill = data.jsonDynamicbill;
		            	formatMapObj(dynamicbill);
		            	
		       			//标题
		       			if($.trim(dynamicbill.DYNAMICBILL_TITLE) != ""){
			       			$('#dynamicbill_info_title').text(dynamicbill.DYNAMICBILL_TITLE);
		       			}
		       			//创建时间
		       			if($.trim(dynamicbill.CREATE_DATE_FORMAT) != ""){
			       			$('#dynamicbill_info_createDate').html("发布时间：" + dynamicbill.CREATE_DATE_FORMAT);
		       			}
		       			//内容
		       			if($.trim(dynamicbill.DYNAMICBILL_CONTENT) != ""){
		       				$("#mobileText").html(dynamicbill.DYNAMICBILL_CONTENT);
			       			$('#dynamicbill_info_content').text($("#mobileText").text());
		       			}
		       			var dynamicbillUrl = data.url;
		       			var dynamicbillPath = dynamicbill.DYNAMICBILLIMG_PORTAL_PATH;
		       			
		       			//缩略图路径
		       			var abbrImageUrl = data.abbrImageUrl;
		       			if(abbrImageUrl == null || typeof(abbrImageUrl) == "undefined" || abbrImageUrl == ""){
		       				abbrImageUrl = "";
		       				$("#dynamicbill_info_img").hide();
		       			}else{
		       				$("#dynamicbill_info_img").show();
		       			}
		       			$('#dynamicbill_info_img').attr("src",abbrImageUrl);
		       			
		       			var imgUrl = dynamicbillUrl + dynamicbillPath;
		       			//图片
		       			$('#dynamicbill_info_img').addEventListener("quickClick",function(arg){
							return function(){
								//加载等待
								showLoadPage("打开中，请稍后...");
								var imgName = arg.substr(arg.lastIndexOf("/") + 1);
								var imgType = imgName.substr(imgName.lastIndexOf(".") + 1);
								imgType = imgType.toLowerCase();
								var fileTransfer = new FileTransfer();
								fileTransfer.downloadFile(function(arg){
										device.openLocalFile(function(arg){
											//结束等待
											hideLoadPage();
										}
										,function(arg){
											//结束等待
											hideLoadPage();
											indexObj.showMsgDialog("0","打开失败！");
										},'/sdcard/JSICT_Files/' + imgName,imgType);
									},function(arg){
										//结束等待
										hideLoadPage();
										indexObj.showMsgDialog("0","下载失败！");
									},arg,'/sdcard/JSICT_Files/',imgName);
							};
						}(imgUrl));
		       		}else{
		       			window.is_load_dynamicbill_info == "1";
		       			//加载失败
      					loadingFail();
		       		}
		       		
		       		//结束等待
					hideLoadPage();
        		},error:function(){
	        		connectionFail();
	       		}
            });
		}
		$("#mobile-dynamicbill-show-page").live("pageshow",function(){
			$("#mobileDynamicbillShowWrapper")[0].style.height = window.innerHeight-$("#mobileDynamicbillShowHeader").height()-$("#mobileDynamicbillShowFooter").height() +"px";
			
			initScroll({
				"wrapper": "mobileDynamicbillShowWrapper", //滚动组件的id
				"dir": "y", //滚动的方向，x或者y
				"bounce": true, //是否限制超出边界，默认为false
				"scrollExBottomHandler": function(backToBottom){
					backToBottom.call();
				},
				"scrollExTopHandler": function(backToTop){backToTop.call()},
				"scrollingExBottomHandler": function(y){},
				"scrollingExTopHandler": function(y){}
			});
			scrollToTop("mobileDynamicbillShowWrapper");
		});
		</script>
			<div data-role="header" data-theme="b" data-position="" id="mobileDynamicbillShowHeader">
			</div>
			<div data-role="content" id="mobileDynamicbillShowWrapper" class="jszx-wrapper">
				<div id = "mobileDynamicbillShowScroller" class="jszx-scroller">
					<div class="div_content_01">
						<table data-role="none">
							<tr>
								<td colspan="2" id="dynamicbill_info_title"  align="center" class="title"></td>
							</tr>
							<tr>
								<td colspan="2" align="left" id="dynamicbill_info_createDate" class="text_time_style"></td>
							</tr>
							<tr>
								<td colspan="2" align="center">
									<img id="dynamicbill_info_img" src="" name="dynamicbill">
								</td>
							</tr>
							<tr>
								<td colspan="2" id="dynamicbill_info_content" align="left" class="content_02"></td>
							</tr>
						</table>
					</div>
				</div>
			</div>
			<div data-role="footer" data-theme="b" data-position="" id="mobileDynamicbillShowFooter"class="ui-bar footer_div_style">
				<div id="mobileDynamicbillShowBar" class="ui-grid-d jszx-bar-icon-up bar-bottom" align="center">
				</div>
			</div>
		</div>
	</body>
</html>